from django.shortcuts import render


# Create your views here.
def home(request):
    import requests
    import json
    # api_request = requests.get("http://api.github.com/users?since=0")
    # api = json.loads(api_request.content)

    data = [{"name": 'saddle', "brand": 'dior'}, {"name": 'ohanel', "brand": 'chanel'}]

    return render(request, "home.html", {"data": data})  # 调用 hermes/templates home.html文件

# user 页面
def user(request):
    if request.method == "POST":
        user = request.POST['user']
        return render(request, 'user.html', {'user': user})
    else:
        notfound = "请在输入框中输入您要查询的用户..."
        return render(request, 'user.html', {'notfound': notfound})